import Vue from 'vue'
import VueRouter from 'vue-router'

const Home = () => {
  return import('../views/Home.vue')
}
const PostDetail = () => {
  return import('../views/PostDetail')
}
const MoreComment = () => {
  return import('../views/MoreComment')
}
const Search = () => {
  return import('../views/Search')
}

const Login = () => {
  return import('@/views/Login')
}
const Register = () => {
  return import('@/views/Register')
}

const PersonalIndex = () => {
  return import('../views/personal/Index')
}
const PersonalEdit = () => {
  return import('../views/personal/Edit')
}
const PersonalFollows = () => {
  return import('../views/personal/Follows')
}
const PersonalStar = () => {
  return import('../views/personal/Star')
}
const PersonalComment = () => {
  return import('../views/personal/Comment')
}
const PersonalManage = () => {
  return import('../views/personal/Manage')
}

const Test = () => {
  return import('../views/Test')
}

Vue.use( VueRouter )

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home
  },
  {
    path: '/postdetail',
    name: 'DetailPage',
    component: PostDetail
  },
  {
    path: '/morecomment',
    name: 'MoreCommentPage',
    component: MoreComment
  },
  {
    path: '/search',
    name: 'SearchPage',
    component: Search
  },



  {
    path: '/login',
    name: 'LoginPage',
    component: Login
  },
  {
    path: '/register',
    name: 'RegisterPage',
    component: Register
  },




  {
    path: '/personal',
    name: 'PersonalPage',
    component: PersonalIndex,
    meta: {
      needAuth: true
    }
  },
  {
    path: '/edit',
    name: 'EditPage',
    component: PersonalEdit,
    meta: {
      needAuth: true
    }
  },
  {
    path: '/follows',
    name: 'MyFollowsPage',
    component: PersonalFollows,
    meta: {
      needAuth: true
    }
  },
  {
    path: '/star',
    name: 'MyStarPage',
    component: PersonalStar,
    meta: {
      needAuth: true
    }
  },
  {
    path: '/mycomment',
    name: 'MyCommentPage',
    component: PersonalComment,
    meta:{
      needAuth: true
    }
  },
  {
    path: '/manage',
    name: 'ManagePage',
    component: PersonalManage,
  },



  {
    path: '/test',
    component: Test
  }
]

const router = new VueRouter( {
  routes
} )

export default router
